import { defineConfig } from 'vite'
import type {UserConfig, ConfigEnv} from 'vite'
import vue from '@vitejs/plugin-vue'
import {resolve} from 'path'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import {ElementPlusResolver} from 'unplugin-vue-components/resolvers'
import ElementPlus from 'unplugin-element-plus/vite'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue(),
    AutoImport({
      resolvers:[ElementPlusResolver()]
    }),
    Components({
      resolvers:[ElementPlusResolver()]
    }),
    ElementPlus({

    })
  ],
  publicDir:'public',
  base:"./",
  server:{
    host:'0.0.0.0',
    port:8812,
    open:false,
    strictPort:false
  },
  resolve:{
    alias:{
      "@":resolve(__dirname,"./src"),
      "components":resolve(__dirname,"./src/components"),
      "api":resolve(__dirname,"./src/api")
    }
  },
  css:{
    preprocessorOptions:{
      scss:{
        additionalData:`@use "./src/assets/css/variable.scss" as *;`
      }
    }
  },
  build:{
    outDir:'dist'
  }
})
